package com.gj.modules.gj.controller.api;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gj.common.utils.R;
import com.gj.common.validator.Assert;
import com.gj.modules.gj.controller.CommonController;

/**
 * API登录授权
 */
@RestController
@RequestMapping("/api")
public class ApiController extends CommonController{

    /**
     * 登录
     */
    @GetMapping("login")
    public R login(String mobile, String password){
     /*   Assert.isBlank(mobile, "手机号不能为空");
        Assert.isBlank(password, "密码不能为空");*/
        long expires=springEhcacheUtil.getCacheManager().getCache("apiTokenCache").getCacheConfiguration().getTimeToIdleSeconds();
        System.out.println(expires);

        //生成token
        Map<String, Object> map =new HashMap();
        map.put("mobile", mobile);
        map.put("password", password);

        return R.ok(map);
    }
    
}
